<%@ page language="java" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>添加学院</title>
		<link rel="stylesheet" type="text/css"
			href="../jquery/themes/default/easyui.css" />
		<link rel="stylesheet" type="text/css"
			href="../jquery/themes/icon.css">
		<script type="text/javascript" src="../jquery/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="../jquery/jquery.easyui.min.js"></script>
		<script type="text/javascript"
			src="../jquery/locale/easyui-lang-zh_CN.js"></script>
		<script type="text/javascript">
			function cancel(){
				parent.closeAddDialog();
			}
			function addCollege(){
				var collegename = $("#collegename").val();
				var desc =$("#desc").val();
				var enable = document.getElementById("enable").checked?"1":"0";
				if(collegename.replace(/\s/g,"")==""){
					$.messager.alert("错误","学院名不能为空");
					return ;
				}
				$("#waiting").window("open"); 
				$.ajax({
					url : "../course/admin/collegemgr.do",
					type : "POST",
					data : {
						cmd : "add",
						collegename : encodeURIComponent(collegename),
						desc : encodeURIComponent(desc),
						enable : enable
					},
					success : function(data, textStatus) {
						$("#waiting").window("close"); 
						var result = eval('(' + data + ')');
						if (result.error) {
							$.messager.alert("错误", result.msg);
						} else {
							cancel();
							parent.$.messager.alert("OK", "添加成功");
							parent.setTimeout(function(){parent.reloadDataGrid(parent.renderPager);},10);				
						}
					}
				});
			}
		</script>
	</head>

	<body>
		<table>
			<tr>
				<td>
					<label for="collegename">
						学院名称：
					</label>
				</td>
				<td>
					<input class="easyui-validatebox" type="text" size="50"
						id="collegename" required="true" />
				</td>
			</tr>
			<tr>
				<td>
					学院简介：
				</td>
				<td>
					<textarea id="desc" cols="60" rows="15"></textarea>
				</td>
			</tr>
			<tr>
				<td>
					启用：
				</td>
				<td>
					<input type="checkbox" id="enable" checked="checked" />
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<img alt="添加" src="../images/add.png" title="添加"
						style="cursor: pointer;" onclick="javascript:addCollege()" />
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<img alt="添加" src="../images/cancel.png" title="取消"
						style="cursor: pointer;" onclick="javascript:cancel()" />
			</tr>
		</table>
		<div id="waiting"  class="easyui-window"  modal="true" closable="false" resizable="false" title="添加学院中" closed="true">
			<img src="../images/waiting.png"/>正在处理，请稍后。。。。。。
		</div>
	</body>
</html>
